﻿using reactiveBT.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace reactiveBT.BT.Node
{
    public class Failure : Branch
    {
        public override BTState Tick(int BTid)
        {
            if (children.Count > 1)
            {
                throw new Exception("Failure节点的子节点数不能大于1");
            }
            var result = children[0].Tick(BTid);
            switch (result)
            {
                case BTState.Continue:
                    return BTState.Continue;
                case BTState.Abort:
                    return BTState.Abort;
                default:
                    return BTState.Failure;
            }
        }
    }
}
